<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>支付页面</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#contacts").focus();
			$("#inputForm").validate({
				rules: {
				contacts: {maxlength:50},
					payertel:{mobile:true}
				},
				messages:{
					contacts: {maxlength:'联系人姓名过长'}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			$.validator.addMethod("mobile", function(value, element) {
				var length = value.length;
				var mobile = /^1[3|4|5|7|8]\d{9}$/;
				return this.optional(element) || (length == 11 && mobile.test(value));
			}, "手机号格式不对");
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a>订单支付方式</a></li>
	</ul>
	<form id="inputForm" action="${ctx}/pay/pay" method="post" class="form-horizontal">
		<input type="hidden" name="orderid" value="${orders.orderid }"/>
		<input type="hidden" name="ordertype" value="${orders.ordertype }"/>
		<sys:message content="${message}" />
		<div class="control-group">
			<label class="control-label" for="purchasenum">请选择支付方式</label>
			<div class="controls">
				<label class="radio">
					<input type="radio" name="payway" value="${payWayType.payWayAlipay }" checked>
					<img src="${ctxStatic }/images/zhifubao.jpg" class="img-polaroid" style="width:200px;height:90px;">
				</label>
				<label class="radio">
					<input type="radio" name="payway" value="${payWayType.payWayWxpay }">
					<img src="${ctxStatic }/images/weixin.png" class="img-polaroid" style="width:220px;height:90px;">
				</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="purchasenum">支付金额</label>
			<div class="controls">
				<input type="text" value="￥${orders.dueamount }" readonly/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="contacts">联系人姓名</label>
			<div class="controls">
				<input type="text" id="contacts" name="contacts" value="${orders.contacts }" class="required" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="payertel">手机号</label>
			<div class="controls">
				<input type="text" id="payertel" name="payertel" value="${orders.payertel }" class="required" />
			</div>
		</div>
		<div class="form-actions">
			<input class="btn btn-primary" type="submit" value="确认"/>
			<input class="btn" type="button" value="返回" onclick="history.go(-1)"/>
		</div>
	</form>
</body>
</html>